import { ItemData } from "../../../resource/info/ItemData";
import { TItemWeapon } from "../../../../../Message/Db/Tables/TItemWeapon";
import { GameDefConfig } from "../../../resource/GameDefConfig";
import { EEquip } from "../../../../../Message/Public/EEquip";
import { Language } from "../../../../../extend/language/Language";
import { ItemExInfo } from "../../../resource/info/ItemExInfo";
import { ItemInfo } from "../../../resource/info/ItemInfo";
//class ItemDataWorking
    
    export  class ItemDataWorking
    {
        

        public static getItemDataName(arg1: ItemData, arg2: Boolean=true): string
        {
            ItemDataWorking._itemData = arg1;
            ItemDataWorking._itemExInfo = ItemDataWorking._itemData.itemExInfo;
            ItemDataWorking._itemInfo = ItemDataWorking._itemData.itemInfo;
            if (ItemDataWorking._itemData && ItemDataWorking._itemInfo && ItemDataWorking._itemInfo.extend && ItemDataWorking._itemInfo.extend is TItemWeapon) 
            {
                ItemDataWorking._tItemWeap = ItemDataWorking._itemInfo.extend as TItemWeapon;
            }
            else 
            {
                ItemDataWorking._tItemWeap = null;
            }
            return ItemDataWorking.getNameText(arg2);
        }

        public static getNameText(arg1: Boolean=true): string
        {
            var loc4=0;
            var loc5=null;
            var loc1="";
            var loc2="";
            var loc3="";
            if (ItemDataWorking._tItemWeap) 
            {
                loc2 = ItemDataWorking._itemData.name;
                if (ItemDataWorking._itemExInfo) 
                {
                    loc4 = ItemDataWorking._itemExInfo.prefix;
                    if ((loc5 = GameDefConfig.instance.getEPrefixx(loc4, ItemDataWorking._tItemWeap.type)) && (ItemDataWorking._tItemWeap.color > 2 || ItemDataWorking._tItemWeap.type == EEquip._EEquipHeartLock)) 
                    {
                        loc3 = loc5.name;
                    }
                }
            }
            else if (ItemDataWorking._itemData.itemInfo) 
            {
                loc2 = ItemDataWorking._itemData.name;
            }
            else 
            {
                loc2 = Language.getString(40667);
            }
            if (ItemDataWorking._itemExInfo && !(ItemDataWorking._itemExInfo.strengthen == 0)) 
            {
                loc2 = loc2 + ("+" + ItemDataWorking._itemExInfo.strengthen);
            }
            else if (ItemDataWorking._itemExInfo && !(ItemDataWorking._itemExInfo.sp_eq_str == 0)) 
            {
                loc2 = loc2 + ("+" + ItemDataWorking._itemExInfo.sp_eq_str);
            }
            if (loc3 != "") 
            {
                if (arg1) 
                {
                    loc3 = "[" + loc3 + "]";
                }
                else 
                {
                    loc3 = loc3 + Language.getString(40668);
                }
            }
            loc1 = loc3 + loc2;
            return loc1;
        }

        /* internal */ static /* var */_itemData: ItemData;

        /* internal */ static /* var */_itemExInfo: ItemExInfo;

        /* internal */ static /* var */_itemInfo: ItemInfo;

        /* internal */ static /* var */_tItemWeap: TItemWeapon;
    }
